const { src, dest, series, parallel } = require("gulp");
const ts = require("gulp-typescript");

const transform = () => {
  return src("src/**/*.ts", { base: "src" })
    .pipe(
      ts({
        target: "ES5",
        module: "cmommjs",
        allowSyntheticDefaultImports: true,
        declaration: true,
      })
    )
    .pipe(dest("lib"));
};

const esmodule = () => {
  return src("src/**/*.ts", { base: "src" })
    .pipe(
      ts({
        target: "ES5",
        allowSyntheticDefaultImports: true,
        declaration: true,
      })
    )
    .pipe(dest("es"));
};

const compile = parallel(transform, esmodule);

module.exports = {
  transform,
  esmodule,
  compile,
};
